Read about navigation drawer android studio, The latest news, videos, and discussion topics about navigation drawer android studio from alibabacloud.com
On the day of Google Io, the Android team updated the support library and added several more important features to the support library of the new version (V13).Adds a drawerlayout control that supports the creation of Navigation drawer mode. Can be set from the left side of the menu or the right side, can also left the menu to exist.Add Slidingpanelayout controls
Let's focus on the Android drawer navigation Navigationdrawer. First of all to perceptual the effect of this bar:
Looking at a lot of applications, I think this slippery drawer effect of the menu is very good. Do not have to switch to another page, also do not have to press the menu hardware button, directly in the
take advantage of the new visual drawer transition.
Any view isn't represented in the drawer maintains the traditional up indicator on its action bar.
You stay on sync with the general navigation patterns for up and back.
What to support when navigating with drawers Perhaps your app has used a drawer
Google updated its Google + app in July this year, adopting a new approach to navigation and abandoning navigationdrawer. In the moment, there is a series of discussions about the pros and cons of Navigationdrawer, but for developers we just have to take care of what we need to achieve or learn, 2012 YouTube, Facebook, Path and other applications have used navigationdrawer such a way of navigation, last yea
1. Create a drawer Layout
UseDrawerLayoutAs the interface root control. In drawerlayout, the first view is the main content of the current interface, and the second and third views are the drawer menu content. If the current interface only needs one drawer menu, the third view can be omitted.
In the following example, drawerlayout contains two views. The first fr
support a similar navigation drawer, the update your drawer to the this pattern to make sure that:
The action Bar remains in place and adjusts its content.
Your Navigation drawer overlays the content.
Any view represented in the
ListView ).
Note:
1. The content view must be the first subview of DrawerLayout. The reason is that the View order in the XML layout file is the z-ordering order in the Android system, and the Navigation Drawer must appear on the content.
2. The content view must be filled with the parent component, because when Drawer
throughout the UI navigation drawer.
(3) The drawer view (the ListView above) must specify its horizontal gravity and the android: layout_gravity attribute. Supports the right-to-left language (RTL), specifying the value and "start" instead of "Left" (the layout is RTL in the right
Navigation menu for drawer effectSee a lot of applications, feel this slide-off drawer effect of the menu is very good. You don't have to switch to another page, you don't have to press the hardware button on the menu, you just click on the button on the interface, the menu slides out, and you feel like you can put a lot of things. On the implementation, search
First look at the effect
Use the latest android-support-v4.jar
/* Drawer navigation variable */private drawerlayout mdrawerlayout; private listview mdrawerlist; private actionbardrawertoggle mdrawertoggle ;... /* drawer navigation related */mdrawerlayout = (drawerlayout)
DrawerLayout that contains two subviews: FrameLayout, including the main content (filled with Fragment at runtime), and a navigation drawer of ListView.
1
This layout file demonstrates some important Layout features as follows:
The main content view (FrameLayout above) must be the first child view object of the DrawerLayout layout object, because the xml file means z sorting (that is, the upper and lowe
it is in the Compatibility pack of Material Design, you need to first introduce it in Build.gradle ‘com.android.support:design:23.1.1‘ActionbardrawertoggleImplement return picture and animation effectshttp://blog.csdn.net/chencehnggq/article/details/21492417http://blog.csdn.net/zxm317122667/article/details/50989346Actionbardrawertoggle is the listener for the Drawerlayout event.Actionbardrawertoggle has 3 methods that can be replicated to implement Drawerlayout open, close, and sliding event
:
Some details to be aware of
1. There are a number of areas needing attention that need to be added, the effect currently achieved, drawerlayout is covered by the status bar , the benefit is that drawerlayou has more space to present the content. This is Google's official recommendation of the effect, Google's official app is also gradually replaced by this effect.2. Set StatusBar colorA. Add the android:fitssystemwindows= "true" attribute to the
Android -- DrawLayout navigation drawerThe implementation of DrawLayout is detailed in the official documentation. However, during the development process, it is still a bit problematic. The official documentation is a bit old. mDrawerToggle = new ActionBarDrawerToggle (this, mDrawerLayout, r. string. open, R. string. close); the original api of this method can set the icon image of the app. Now this parame
the first child element of drawlayout, because the navigation drawer is above the main content view.
The main content view is set to match the width and height of the parent view, because it indicates that the navigation drawer of the entire interface is hidden.
The horizontal gravity and
Editor's note: This writer, Anthony Rose, co-founder and CTO of social networking Radio Zeebox, analyzes the pros and cons of sidebar Navigation and tab navigation, as well as the detailed process of a/b test for the revision process, and finally gives advice, After reading can have a clear understanding of these two kinds of navigation, very valuable experience
Material Design-compliant drawer navigation effect
Original link: Navigation Drawer styling according to Material Design
Translator: wly2014
Reviewer: chaossss
Status: Proofreading Complete
Objective:Now it seems that the drawer
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.